<?php

/**
 * This file is part of the Pagizer package.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @copyright   Copyright (c) 2010 Advisa (http://www.advisa.fr)
 * @author      Pagizer Core Team <team@pagizer.org>
 * @package     Pagizer
 * @subpackage  backoffice
 */

class m_backoffice_actions_block_SystemDevelopmentAction extends f_core_Action
{
	public function execute()
	{
        $config = f_loader_Config::getInstance();

        $formValues = $this->getFormValues('form');

        $this->addToModel('logSize',f_file_Directory::getInstance(realpath(LOGS_DIR).DS)->getFormattedSize($this->getDisplayLang()));
            
        if(!is_null($formValues))
        {
            foreach($formValues as $key => $value)
            {
                $config->setParameter('default', $key, $value);
            }
            $config->save();
            $this->addToModel('status', 'refresh');
        }

        $this->addToModel('config', $config);
		$this->setView('success');
	}
	
	public function validate()
	{
		return $this->getUserContext()->hasRight("backoffice_accessSystem");
	}
	
	public function errorHandler()
	{
		return null;
	}
}